package com.whjfxx.terminal.valid;

import com.whjfxx.terminal.exceptions.BizException;
import com.whjfxx.terminal.req.EmpowerReq;
import org.apache.commons.lang3.StringUtils;

/**
 * Created by b.c on 2022/1/6 11:08
 */
public class PosEmpowerValid {

    /**
     * 校验数据
     * @param req
     */
    public static void authorize(EmpowerReq req) {
        if (StringUtils.isBlank(req.getGrant_type())) {
            throw BizException.build("grant_type不能为空");
        }
        if (StringUtils.isBlank(req.getClient_id())) {
            throw BizException.build("client_id不能为空");
        }
        if (StringUtils.isBlank(req.getClient_secret())) {
            throw BizException.build("client_secret不能为空");
        }
        if (StringUtils.isBlank(req.getCode())) {
            throw BizException.build("code不能为空");
        }
    }

}
